<template>
  <i-biz-span
    v-if="editorType === 'SPAN'"
    :controller="controller"
    v-bind="$attrs"
  />
  <i-biz-switch
    v-else-if="editorType === 'MOBSWITCH'"
    :controller="controller"
    v-bind="$attrs"
  />
  <i-biz-date-picker
    v-else-if="
      editorType === 'MOBDATE' ||
      editorType === 'MOBDATE_HOUR' ||
      editorType === 'MOBDATE_MINUTE' ||
      editorType === 'MOBDATE_NODAY' ||
      editorType === 'MOBDATE_NODAY_NOSECOND' ||
      editorType === 'MOBDATE_NOTIME' ||
      editorType === 'MOBDATE_SECOND'
    "
    :controller="controller"
    v-bind="$attrs"
  />
  <i-biz-rate
    v-else-if="editorType === 'MOBRATING'"
    :controller="controller"
    v-bind="$attrs"
  />
  <i-biz-input
    v-else-if="editorType === 'MOBTEXT' || editorType === 'MOBPASSWORD'"
    :controller="controller"
    v-bind="$attrs"
  />
  <i-biz-input-number
    v-else-if="editorType === 'MOBNUMBER'"
    :controller="controller"
    v-bind="$attrs"
  />
  <view v-else>{{ editorType }}类型编辑器占位</view>
</template>
<script lang="ts">
export default {
  options: {
    addGlobalClass: true,
    virtualHost: true,
    styleIsolation: "shared"
  }
}
</script>
<script setup lang="ts">
import { useNamespace } from "@/use";
import { IEditorController } from "@ibiz-template/runtime";
import { PropType, useAttrs } from "vue";
const ns = useNamespace("editor-shell");

const props = defineProps({
  controller: {
    type: Object as PropType<IEditorController>,
    required: true,
  },
});

const editorType = props.controller.model.editorType;
</script>
